package com.ai.entity.made.camera;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.beans.BeanUtils;
import org.springframework.data.annotation.Transient;

import java.io.Serializable;
import java.util.Date;


@Data
@Accessors(chain = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class CameraVO implements Serializable {

    @ApiModelProperty(value = "主键,主键ID")
    private Integer id;

    @ApiModelProperty(value = "代号（备用主键）")
    private String code;

    @ApiModelProperty(value = "摄像头名")
    private String nickname;

    @ApiModelProperty(value = "摄像头帐号")
    private String username;

    @ApiModelProperty(value = "摄像头密码")
    private String password;

    @ApiModelProperty(value = "摄像头IP")
    private String ip;

    @ApiModelProperty(value = "摄像头RTSP地址")
    private String url;

    @ApiModelProperty(value = "状态(1.开，2.关，-1.弃用)")
    private Integer state;

    @ApiModelProperty(value = "服务器ID")
    private Integer serverId;

    @ApiModelProperty(value = "服务器ID")
    private String serverNickname;

    @ApiModelProperty(value = "数据添加时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;

    @ApiModelProperty(value = "备注")
    private String remark;

    @ApiModelProperty(value = "端口")
    private String port;

    @ApiModelProperty(value = "取流方式,1rtsp 2天地伟业")
    private Integer streamWay;

    @Transient
    private String bindServerAdd;

    @Transient
    private String regionName;

    @Transient
    private String regionCode;

    @ApiModelProperty(value = "0:软解码，1：硬解码")
    private Integer switchDecoderType;

    @ApiModelProperty(value = "解码gpu模块选择")
    private Integer checkGpu;

    /**
     * 1-在线，0-离线，-1-未检测
     */
    @ApiModelProperty(value = "摄像头设备状态")
    private Integer status;

    public static CameraVO convertPOToVO(CameraPO cameraPO) {
        CameraVO cameraVO = new CameraVO();
        BeanUtils.copyProperties(cameraPO, cameraVO);
        return cameraVO;
    }
}
